import numpy as np
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
x=np.array([[100],[113],[90],[89],[60],[70],[50],[45],[55],[78]])
y=np.array([[301],[324],[285],[296],[200],[260],[300],[120],[180],[245]])
plt.xlabel('面积')
plt.ylabel('售价')
plt.rcParamsl['font.sans-serif']='Simhei'
plt.axis([40,125,100,400])


model=LinearRegression()
model.fit(x,y)
y2=model.predict(x)
print("w=",model.coef [e],"b=",model.intercept )
plt.scatter(x,y,s=60,c='k',marker='o')
plt.plot(x,y2,'r-')
plt.show()
a=model.predict([[200]])
print("200平房屋的价格是:"a[0][0])